package us.kg.kotoriforest.spring.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import us.kg.kotoriforest.spring.pojo.Dog;

/**
 * @author Kotori rotroutine@163.com
 * @since 2025/1/25
 */
@Configuration
@PropertySource(value = "classpath:dog.properties", encoding = "UTF-8")
// 说明属性来源 该注解如果想生效必须要和@Configuration等一起使用 因为只有IOC容器上下文才能被读取到
public class DogConfig {

    @Bean
    public Dog dog1() {
        return new Dog();
    }

    @Bean
    public Dog dog2() {
        return new Dog(null, "小白", 2, "黑色");
    }
}
